package com.prp.algorithm;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class UserValidation {
	public static boolean validateEmail(String email) {
		Pattern p = Pattern
				.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
		Matcher m = p.matcher(email);
		return m.matches();
	}

	public static boolean validateUsername(String username) {
		Pattern p = Pattern.compile("^[a-zA-Z0-9\u4E00-\u9FFF]{1,16}$");
		Matcher m = p.matcher(username);
		return m.matches();
	}
	
}
